package com.bcu.calculus.controller;

import com.bcu.calculus.config.GlobalConfig;
import com.bcu.calculus.entity.Act;
import com.bcu.calculus.entity.ActNumber;
import com.bcu.calculus.entity.Message;
import com.bcu.calculus.service.ActService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;


@Api(tags = "03  活动模块")
@RestController
@RequestMapping("/api/Act")
public class ActController {

        @Resource
        private ActService actService;

        @ApiOperation(value = "添加活动")
        @PostMapping(value = "/inster")
        public Message<?> insert(ActNumber actNumber) throws ParseException {
        return actService.insert(actNumber);
    }


        @ApiOperation(value = "通过关键字删除")
        @DeleteMapping(value = "/deleteByPrimaryKey")
        public Message deleteByPrimaryKey(Integer actId) {
        return actService.deleteByPrimaryKey(actId);
    }


        @ApiOperation(value = "通过主键修改")
        @PutMapping(value = "/updateByPrimaryKey")
        public Message updateByPrimaryKey(ActNumber ActNumber) throws ParseException {
        return actService.updateByPrimaryKey(ActNumber);
    }

        @ApiOperation(value = "通过关键字查询")
        @GetMapping(value = "/selectByPrimaryKey")
        public Message<Act>selectByPrimaryKey(Integer actId) {
        return actService.selectByPrimaryKey(actId);
    }

        @ApiOperation(value = "查询所有活动")
        @GetMapping(value = "/selectAllAct")
        public Message<List<Act>> selectAllAct(){
        return actService.selectAllAct();
    }


        @ApiOperation(value = "通过SendId查询所有活动和图片一级不通过信息")
        @GetMapping(value = "/selectActBySendId")
        public Message<List<Act>> findActBySendId(String sendId){

            return actService.selectActsBySendId(sendId);

        }


}
